package com.yourwork.dao.imp;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;

import com.yourwork.common.jpa.ServiceProjectRepositoey;
import com.yourwork.dao.ServiceProjectDao;
import com.yourwork.model.ServiceProject;
@Repository(value="serviceItemDao")
public class ServiceProjectDaoImp implements ServiceProjectDao {
	@Autowired
	private ServiceProjectRepositoey serviceItemRepositoey;
	//id查询对应的记录
	public ServiceProject queryServiceItem(int id) {
		// TODO Auto-generated method stub
		return serviceItemRepositoey.findById(id);
	}
	public List<ServiceProject> queryServiceItemAll(boolean status) {
		// TODO Auto-generated method stub
		return serviceItemRepositoey.findByStatus(status);
	}
	public void insertServiceItem(ServiceProject serviceItem) {
		// TODO Auto-generated method stub
		serviceItemRepositoey.save(serviceItem);
	}
	public void updateStatus(ServiceProject serviceItem) {
		// TODO Auto-generated method stub
		serviceItemRepositoey.saveAndFlush(serviceItem);
	}
	public List<ServiceProject> queryServiceItemA() {
		// TODO Auto-generated method stub
		return serviceItemRepositoey.findAll();
	}
	public int countServiceItem(boolean status) {
		// TODO Auto-generated method stub
		return serviceItemRepositoey.findByStatus(true).size();
	}
	public List<ServiceProject> queryServiceItemAllF(boolean status, Pageable pageable) {
		// TODO Auto-generated method stub
		return serviceItemRepositoey.findByStatus(status,pageable);
	}

}
